import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const context = require.context("./modules", true, /\.js$/);
const modules = context.keys().reduce((total, path) => {
  const name = path.replace(/\.\/|\.js/g, "");
  total[name] = context(path).default;
  return total;
}, {});

const store = new Vuex.Store({ modules });

export default store;
